﻿<%@ Page Language="C#" %>
<%@ Import Namespace="HF.BizWinner.Lib.Util" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<head runat="server" />
<%
 
//清除该页输出缓存，设置该页无缓存
Response.Buffer = true;
Response.ExpiresAbsolute = System.DateTime.Now.AddMilliseconds(0);
Response.Expires = 0;
Response.CacheControl = "no-cache";
Response.AppendHeader("Pragma", "No-Cache");

RandomCode rc = new RandomCode();
//将验证码图片写入内存流，并将其以 "image/Ppng" 格式输出
MemoryStream ms = new MemoryStream();

try
{
  rc.Image.Save(ms, ImageFormat.Png);
  rc.AddToSession();
  Response.ClearContent();
  Response.ContentType = "image/png";
  Response.BinaryWrite(ms.ToArray());
}
finally
{
  //显式释放资源
  rc.Image.Dispose();
}  
%>